﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Web.UI;
using EverBuy.SocialNetworking.Client;
using log4net;

namespace EverBuy.SocialNetworking.Web
{
    /// <summary>
    /// 
    /// </summary>
    public class PageBase : Page
    {
        /// <summary>
        /// 
        /// </summary>
        protected static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        #region Page Render Timing

        // Page render performance fields.
        protected DateTime _startTime = DateTime.Now;
        protected TimeSpan _renderTime;

        /// <summary>
        /// Sets and gets the page render starting time. This property 
        /// represents the Template Design Pattern.
        /// </summary>
        public DateTime StartTime
        {
            set { _startTime = value; }
            get { return _startTime; }
        }

        /// <summary>
        /// Gets page render time. This property is virtual therefore getting the 
        /// page performance is overridable by derived pages. This property 
        /// represents the Template Design Pattern.
        /// </summary>
        public virtual string PageRenderTime
        {
            get
            {
                _renderTime = DateTime.Now - _startTime;
                return _renderTime.Seconds + "." + _renderTime.Milliseconds + " seconds";
            }
        }

        #endregion
    }
}
